package com.work.demo.methoddemo;

public class FactoryMethod {

	public static void main(String[] args) {
		Application application = new Application();
		ProductA product = application.getObj();

	}


}

interface Product {
	void method1(String type);
}

class ProductA implements Product {
	@Override
	public void method1(String type) {
		System.out.println("ProductA.method1 executed.");
	}
}

class ProductA1 {
	public void method2() {
		System.out.println("ProductA1.method2 executed.");
	}
}

class Application {
	private ProductA createProduct() {
		// 业务逻辑
		return new ProductA();
	}

	ProductA getObj() {
		ProductA product = createProduct();
		return product;
	}
}
